package com.zk.mylib.ui.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.viewpager.widget.ViewPager
import com.google.android.material.tabs.TabLayout
import com.zk.mylib.R
import com.zk.mylib.ui.adapter.ViewPagerAdapter
import com.zk.mylib.ui.view.ViewpagerHeader

/**
 * 动画View
 */
class MotionLayout8Activity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_ui_motionlayout8)
        val viewPagerHeader = findViewById<ViewpagerHeader>(R.id.motionLayout)

        val adapter = ViewPagerAdapter(supportFragmentManager)
        val pager=findViewById<ViewPager>(R.id.pager)
        val tabs=findViewById<TabLayout>(R.id.tabs)
        adapter.addPage("Page 1", R.layout.motion_16_viewpager_page1)
        adapter.addPage("Page 2", R.layout.motion_16_viewpager_page2)
        adapter.addPage("Page 3", R.layout.motion_16_viewpager_page3)
        pager.adapter = adapter
        tabs.setupWithViewPager(pager)
        if (viewPagerHeader != null) {
            pager.addOnPageChangeListener(viewPagerHeader)
        }

        viewPagerHeader.setDebugMode(MotionLayout.DEBUG_SHOW_PATH)
    }
}